package com.pz.cloud.framework.pzStudent.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pz.cloud.framework.base.dao.CommonDao;
import com.pz.cloud.framework.base.model.Pageable;
import com.pz.cloud.framework.business.pzStudent.entity.*;
import com.pz.cloud.framework.business.pzStudent.service.IPzTeacherService;
import com.pz.cloud.framework.business.pzStudent.service.IPzTeacherService;
import com.pz.cloud.framework.model.AbstractSqlBuilder;
import com.pz.cloud.framework.model.SqlBuilder;
import com.pz.cloud.framework.pzStudent.mapper.PzTeacherMapper;
import com.pz.cloud.framework.pzStudent.mapper.PzTeacherMapper;
import org.jeecg.common.util.dynamic.db.SqlUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@DS("pz")
@Service
@Transactional
public class PzTeacherServiceImpl extends ServiceImpl<PzTeacherMapper, PzTeacher> implements IPzTeacherService {

    @Autowired
    private CommonDao commonDao;

    @Override
    public List<PzTeacher> findPage(PzTeacher entity, Pageable pageable) {
        AbstractSqlBuilder sqlBuilder = SqlBuilder.init("select * from ").appendTable(PzTeacher.class).append(" t ");
        return commonDao.findList(SqlBuilder.init(SqlUtils.createPageSqlByDBType("oracle", sqlBuilder.getSql(), pageable.getPageNo(), pageable.getPageSize())).returnType(PzTeacher.class));
    }
}
